<?php
	/**
	 * Created by PhpStorm.
	 * User: mybook-lhp
	 * Date: 18/3/23
	 * Time: 下午7:34
	 */

	include_once 'JwtService.php';
	//	$prekey = require '../rsa/id_rsa';
	//	$pubkey = require '../rsa/id_rsa.pub';
	//var_dump([$prekey,$pubkey]);die;
	/* Some shared objects for tests: */
	$joeStr = "{\"iss\":\"joe\",\"exp\":1300819380,\"http://example.com/is_root\":true}";
	$hs256 = "{\"typ\":\"JWT\",\"alg\":\"HS256\"}";
	$hs384 = "{\"typ\":\"JWT\",\"alg\":\"HS384\"}";
	$hs512 = "{\"typ\":\"JWT\",\"alg\":\"HS512\"}";

	$hsKey = [3, 35, 53, 75, 43, 15, 165, 188, 131, 126, 6, 101, 119, 123, 166, 143, 90, 179, 40, 230, 240, 84, 201, 40, 169, 15, 132, 178, 210, 80, 46, 191, 211, 251, 90, 146, 210, 6, 71, 239, 150, 138, 180, 195, 119, 98, 61, 34, 61, 46, 33, 114, 5, 46, 79, 8, 192, 205, 154, 245, 103, 208, 128, 163];
	$rsKeyPEM = "LS0tLS1CRUdJTiBSU0EgUFJJVkFURSBLRVktLS0tLQpNSUlFb3dJQkFBS0NBUUVBeEV5bWpsbVBNVXN2RTVQVStBVFNOd2c0dkxtS2tEMzFTRzI4WkRuN0RoNmMxT0FoCllYL3lFcCs1QlhxOHliQmtScGZDLzdzclJRNCtUeG5uR3NwUHQvZVF5S2ZORjgwbHd5NFRSQS9TYlJDallmK04KVHE2ZTh2M1FIOE05U2NpS01HME9MbXZNbk9nVi9tVFJVd1pTdUxPZXRaTEQxNmdDZ2QxR0cwc01BS0JYYkpaZwoyb3oxdEp1bFBPdGFDWW1ReHU1M2NWSGtmRHZGLzRLMG1LMTIyam8xRnh4UGtBbjNOcU1Db2QzR3hpOFVIaE5iCjBzOHhsVzl6Ynlvc2RmdGJqOWI1VGRCTXBSUzlmRWllc1psQVpxOGtPa1lUUnJVVHJZdjI1d2pYaEhCSGNOeUsKVEhDbjVYZGl2dTdzZFBMZVB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F4dTUzY1ZIa2ZEdkYvNEswbUsxMgoyam8xRnh4UGtBbjNOcU1Db2QzR3hpOFVIaE5iMHM4eGxXOXpieW9zZGZ0Ymo5YjVUZEJNcFJTOWZFaWVzWmxBClpxOGtPa1lUUnJVVHJZdjI1d2pYaEhCSGNOeUtUSENuNVhkaXZ1N3NkUExlUERqOG5IUm5MajRya1NqS3BpRkcKYXdJREFRQUIKLS0tLS1FTkQgUFVCTElDIEtFWS0tLS0tCg==";
	$rsPubKeyModulus = "C44CA68E598F314B2F1393D4F804D2370838BCB98A903DF5486DBC6439FB0E1E9CD4E021617FF2129FB9057ABCC9B0644697C2FFBB2B450E3E4F19E71ACA4FB7F790C8A7CD17CD25C32E13440FD26D10A361FF8D4EAE9EF2FDD01FC33D49C88A306D0E2E6BCC9CE815FE64D1530652B8B39EB592C3D7A80281DD461B4B0C00A0576C9660DA8CF5B49BA53CEB5A098990C6EE777151E47C3BC5FF82B498AD76DA3A35171C4F9009F736A302A1DDC6C62F141E135BD2CF31956F736F2A2C75FB5B8FD6F94DD04CA514BD7C489EB1994066AF243A461346B513AD8BF6E708D784704770DC8A4C70A7E57762BEEEEC74F2DE3C38FC9C74672E3E2B9128CAA621466B";
	$rsPubKeyExponent = "10001";


	$es256 = "{\"alg\":\"ES256\"}";
	$es384 = "{\"alg\":\"ES384\"}";
	$es512 = "{\"alg\":\"ES512\"}";

	$rs256 = "{\"alg\":\"RS256\"}";
	$rs384 = "{\"alg\":\"RS384\"}";
	$rs512 = "{\"alg\":\"RS512\"}";

	$hmacKey = "hmackey";
	$sampleHS256 = "eyJ0eXAiOiJKV1QiLA0KICJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJqb2UiLA0KICJleHAiOjEzMDA4MTkzODAsDQogImh0dHA6Ly9leGFtcGxlLmNvbS9pc19yb290Ijp0cnVlfQ.AF9JZKWRn2omJDrJrWeoVQyjR3PcGFiAe0_dC04hwyE";
	$sampleRS256 = "eyJhbGciOiJSUzI1NiJ9.eyJpc3MiOiJqb2UiLA0KICJleHAiOjEzMDA4MTkzODAsDQogImh0dHA6Ly9leGFtcGxlLmNvbS9pc19yb290Ijp0cnVlfQ.PD3-BJR3UrF6del98ffZ8d8Vu3RMLhqj117r6LQNpM5eMImCKarEpqf6j1cu2FZZ9zQzusXPkBYPTUE1SKg8lzJmHbgSAaSunxxprS_XNYbFg8y9twxYBHh3umyJ0JTBWx5OciLQuapX8fKCZXINUXl1ytR1CCw4tSwD3ekMddLlAkmqdn7gYpIswaAO7bMOqrszXM5QAh7AMCwoisFBvUDFCrzs0alLIcPButn6vXo0p7vhakXXUPy7vRgTMsf3kSJcvJzLtxlcV0K1LiiR3wR_dcxSeRNkm075uIggTmSXhtUm7cswEr1u5YVN7F2v1pjg_KYwnhtRkP8AGU-k9g";


	$JWT = JwtService::encode(['a' => 1, 'b' => 2], '123');

	var_dump($JWT);


?>
<html>
<head>
    <title>JSON Web Token Tests</title>
    <script type="text/javascript" src="src/jwt-token.js"></script>
    <script type="text/javascript" src="lib/twu-rsa/rsa.js"></script>
    <script type="text/javascript" src="lib/twu-rsa/jsbn.js"></script>
    <script type="text/javascript" src="lib/sjcl/sjcl.js"></script>


    <script>
        /* Some shared objects for tests: */
        var joeStr = "{\"iss\":\"joe\",\r\n" + " \"exp\":1300819380,\r\n" + " \"http://example.com/is_root\":true}";
        var hs256 = "{\"typ\":\"JWT\",\r\n" + " \"alg\":\"HS256\"}";
        var hs384 = "{\"typ\":\"JWT\",\r\n" + " \"alg\":\"HS384\"}";
        var hs512 = "{\"typ\":\"JWT\",\r\n" + " \"alg\":\"HS512\"}";

        var hsKey = [3, 35, 53, 75, 43, 15, 165, 188, 131, 126, 6, 101, 119, 123, 166, 143, 90, 179, 40, 230, 240, 84, 201, 40, 169, 15, 132, 178, 210, 80, 46, 191, 211, 251, 90, 146, 210, 6, 71, 239, 150, 138, 180, 195, 119, 98, 61, 34, 61, 46, 33, 114, 5, 46, 79, 8, 192, 205, 154, 245, 103, 208, 128, 163];
        var r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GZPaTFjMWl6djQxQ0REWGRQKwpKcTNNbHMzaDVXTnJ5RTdhTTQ5S3JaRWpjbytzajVRc3dMMnkwTk1weHdHRE9palpqS0lyCi0tLS0tRU5EIFJTQSBQUklWQVRFIEtFWS0tLS0tCg==")
        var rsPubKeyPEM = window.atob("LS0tLS1CRUdJTiBQVUJMSUMgS0VZLS0tLS0KTUlJQklqQU5CZ2txaGtpRzl3MEJBUUVGQUFPQ0FROEFNSUlCQ2dLQ0FRRUF4RXltamxtUE1Vc3ZFNVBVK0FUUwpOd2c0dkxtS2tEMzFTRzI4WkRuN0RoNmMxT0FoWVgveUVwKzVCWHE4eWJCa1JwZkMvN3NyUlE0K1R4bm5Hc3BQCnQvZVF5S2ZORjgwbHd5NFRSQS9TYlJDallmK05UcTZlOHYzUUg4TTlTY2lLTUcwT0xtdk1uT2dWL21UUlV3WlMKdUxPZXRaTEQxNmdDZ2QxR0cwc01BS0JYYkpaZzJvejF0SnVsUE90YUNZbVF4dTUzY1ZIa2ZEdkYvNEswbUsxMgoyam8xRnh4UGtBbjNOcU1Db2QzR3hpOFVIaE5iMHM4eGxXOXpieW9zZGZ0Ymo5YjVUZEJNcFJTOWZFaWVzWmxBClpxOGtPa1lUUnJVVHJZdjI1d2pYaEhCSGNOeUtUSENuNVhkaXZ1N3NkUExlUERqOG5IUm5MajRya1NqS3BpRkcKYXdJREFRQUIKLS0tLS1FTkQgUFVCTElDIEtFWS0tLS0tCg==");
        var rsPubKeyModulus = "C44CA68E598F314B2F1393D4F804D2370838BCB98A903DF5486DBC6439FB0E1E9CD4E021617FF2129FB9057ABCC9B0644697C2FFBB2B450E3E4F19E71ACA4FB7F790C8A7CD17CD25C32E13440FD26D10A361FF8D4EAE9EF2FDD01FC33D49C88A306D0E2E6BCC9CE815FE64D1530652B8B39EB592C3D7A80281DD461B4B0C00A0576C9660DA8CF5B49BA53CEB5A098990C6EE777151E47C3BC5FF82B498AD76DA3A35171C4F9009F736A302A1DDC6C62F141E135BD2CF31956F736F2A2C75FB5B8FD6F94DD04CA514BD7C489EB1994066AF243A461346B513AD8BF6E708D784704770DC8A4C70A7E57762BEEEEC74F2DE3C38FC9C74672E3E2B9128CAA621466B";
        var rsPubKeyExponent = "10001";


        var es256 = "{\"alg\":\"ES256\"}";
        var es384 = "{\"alg\":\"ES384\"}";
        var es512 = "{\"alg\":\"ES512\"}";

        var rs256 = "{\"alg\":\"RS256\"}";
        var rs384 = "{\"alg\":\"RS384\"}";
        var rs512 = "{\"alg\":\"RS512\"}";

        var hmacKey = "hmackey"
        var sampleHS256 = "eyJ0eXAiOiJKV1QiLA0KICJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJqb2UiLA0KICJleHAiOjEzMDA4MTkzODAsDQogImh0dHA6Ly9leGFtcGxlLmNvbS9pc19yb290Ijp0cnVlfQ.AF9JZKWRn2omJDrJrWeoVQyjR3PcGFiAe0_dC04hwyE";
        var sampleRS256 = "eyJhbGciOiJSUzI1NiJ9.eyJpc3MiOiJqb2UiLA0KICJleHAiOjEzMDA4MTkzODAsDQogImh0dHA6Ly9leGFtcGxlLmNvbS9pc19yb290Ijp0cnVlfQ.PD3-BJR3UrF6del98ffZ8d8Vu3RMLhqj117r6LQNpM5eMImCKarEpqf6j1cu2FZZ9zQzusXPkBYPTUE1SKg8lzJmHbgSAaSunxxprS_XNYbFg8y9twxYBHh3umyJ0JTBWx5OciLQuapX8fKCZXINUXl1ytR1CCw4tSwD3ekMddLlAkmqdn7gYpIswaAO7bMOqrszXM5QAh7AMCwoisFBvUDFCrzs0alLIcPButn6vXo0p7vhakXXUPy7vRgTMsf3kSJcvJzLtxlcV0K1LiiR3wR_dcxSeRNkm075uIggTmSXhtUm7cswEr1u5YVN7F2v1pjg_KYwnhtRkP8AGU-k9g";


        function assert(x) {
            if (!x) throw "AssertionFailure";
        }

    </script>
    <script>
        var Token = "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpZCI6MSwidXNlcl9pZCI6MSwib3BlbmlkIjoiNTVmNDkxY2MwYTJlNzUzMjBmODg2OTQyM2Y0M2I5ODgiLCJuaWNrbmFtZSI6Ilx1NWMwZlx1NWMwZlx1NzY4NFx1OGQ4NVx1N2VhN1x1N2JhMVx1NzQwNlx1NTQ1OCIsImF2YXRhciI6Ilwvd2VjaGF0XC9pbWdcL2hlYWRfMDNfMDMucG5nIiwidG9rZW4iOiJhY2MxNjAxODFiZmI5OWM1OTQzYWUwYTUzMzU4MzdhYiIsInN0YXR1cyI6MSwidXBkYXRlX3RpbWUiOiIyMDE4LTAzLTIyIDE5OjIwOjQ4IiwidXVpZCI6MCwidXNlcm5hbWUiOiIxIiwiZGVwaWQiOjkzLCJwb3NpZCI6MSwidHJ1ZW5hbWUiOiJcdThkODVcdTdlYTdcdTdiYTFcdTc0MDZcdTU0NTgiLCJzZXgiOiJcdTc1MzciLCJwaG9uZSI6IjEiLCJsZXZlbCI6MywiaWRudW1iZXIiOiI2MjI3MDAxOTg3MDEwMzUyMzgiLCJoaXJlZGF0ZSI6NjUzNTY2NSwiZGltaXNzaW9uIjowLCJncm91cF9pZCI6MSwiY3JlYXRlX3RpbWUiOiIxOTcwLTAxLTAxIDA4OjAwOjAwIn0.nBp2HmQ2zHzEWfce4SSH8BZOYPcDCxZZ_629i9oLo7M";

        // var token = jwt.WebTokenParser.parse(Token);

        var JwtToPHP = {
            $headb64: null,
            $payloadb64: null,
            $cryptob64: null,
            $Token: null,
            $TokenStr: null,
            getPayloadb64: function () {
                return this.jsonToObj(this.$payloadb64);
            },
            Separate: function () {
                var arr = this.$TokenStr.split(".");
                this.$headb64 = jwt.base64urldecode(arr[0]);
                this.$payloadb64 = jwt.base64urldecode(arr[1]);
                this.$cryptob64 = jwt.base64urldecode(arr[2]);
            },
            jsonToObj: function (jsonStr) {
                return JSON.parse(jsonStr);
            },
            decode: function (Token) {
                this.$TokenStr = Token;
                this.Separate();
                var check = this.verifySignature(this.$cryptob64, this.$headb64 + '.' + this.$payloadb64, '1234567890', this.$headb64.alg)
                if (!check) {
                    return '验证失败！';
                }
                return this.getPayloadb64();
            },
            verifySignature: function ($signature, $input, $key, $algo) {
                // console.log([$signature, $input, $key, $algo]);
                // console.log([$signature, $input, $key, $algo]);
                return true;
            }
        };
        var data = JwtToPHP.decode(Token);
        // console.log(data);

        var token = jwt.WebTokenParser.parse(Token);
        // console.log(token);
        // Actual output:
        //     Error: jwt is not defined
        var pubKey = new RSAKey();
        // Actual output:
        //     Error: RSAKey is not defined
        pubKey.setPublic(rsPubKeyModulus, rsPubKeyExponent);
        // Actual output:
        //     Error: Cannot read property 'setPublic' of undefined
        token.verify(pubKey)

    </script>
</head>
<body>
</body>
</html>
